@CI
4年前 提问
1个回答

H3C 交换机上如何抓包

如何在H3C交换机上抓包?

Ann
4年前
官方采纳

在华三交换机上可使用:packet-capture 命令,在用户视图下执行。

具体操作可查看这:https://www.h3c.com/cn/d_202009/1327093_30005_0.htm

#做流统匹配抓包流量
acl advanced 3000
description test 
 rule 0 permit ip source 192.168.1.1 0 destination 192.168.2.1 0
traffic classifier class_test operator and
 if-match acl 3000
#
traffic behavior behavior_test
 accounting packet # 做流量统计
 mirror-to cpu # 镜像到CPU,必须镜像到CPU才能抓包
#
qos policy policy_test
 classifier class_test behavior behavior_test
#
interface Ten-GigabitEthernet1/3/1
  qos apply policy policy_test inbound 
packet-capture local  interface  Ten-GigabitEthernet  1/3/1 autostop  filesize  50000 write  flash:/isp1.cap
packet-capture stop # 及时停止。

需要注意的几点:

抓包时尽量使用acl匹配精确的流
在traffic behavior中,必须配置流量镜向到CPU。mirror-to cpu, 否则不能抓到包。
抓包时做好文件大小限制,autostop filesze 50000, 因为交换机的硬盘都很小,防止把交换机硬盘打满。
抓包时尽量选择流量低峰期。
配置accounting packet 流量统计后,可通过display qos policy interface 查看匹配情况。